<script>
  // for (var i = 0; i < 3; i++) {
  //   setTimeout(() => {
  //     console.log(i);
  //   }, 1000 * i)
  // };
  (function () {
    var a = b = 10
    var a;
    window.b = 10
  })()

  function Foo() {
    getName = function () { console.log(1); }
    return this
  }
  Foo.getName = function () { console.log(2); }
  Foo.prototype.getName = function () { console.log(3); }
  var getName = function () { console.log(4); }
  function getName() { console.log(5); }
  Foo.getName()
  getName()
  Foo().getName()
  getName()
  new Foo().getName()




  let str = 'djksdkjskdksjdfjksfdjbsdjbfsdjhjsfkdjmefbhsfhdgjksdfhjwehukhwerukhuk'
  let obj = {}
  for (let i = 0; i < str.length; i++) {
    let item = str.charAt(i)
    if (obj[item]) {
      obj[item]++
    } else {
      obj[item] = 1
    }
  }
  console.log(obj);
  let max = 0
  for (let k in obj) {
    if (max < obj[k])
      max = obj[k]
  }
  console.log('name' + true);

  String.prototype.name = function (str) {
    return str + this
  }
  console.log('wol'.name('ni'));
</script>